<template>
  <div>
  <preHeader></preHeader>
    <div class="top-block"></div>
    <div class="noticeContent">
      <div class="notice-item" v-for="(item,index) in newsInfo" :key='index'>
        <div class="date">{{new Date(parseInt(item.add_time) * 1000).toLocaleString().replace(/:\d{1,2}$/,' ')}}</div>
        <div class="item-content">
          <div class="item-title">{{item.title}}</div>
          <div class="item-txt" v-html="item.content">
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  import {get_newsinfo} from '@/api/';
  export default {
    data() {
      return {
        newsInfo:null,//公告信息
      }
    },
    methods: {
      getNewsInfo(){
        get_newsinfo().then(res =>{
          console.log(res)
          this.newsInfo = res.data;
        })
      }
    },
    mounted(){
      this.getNewsInfo();
    }

  }
</script>

<style scoped>
  .notice-item {
    padding: 10px 10px 30px;
  }

  .notice-item .date {
    font-size: 12px;
    color: #666;
    text-align: center;
  }

  .notice-item .item-content {
    text-align: start;
    width: 96%;
    margin: 0 auto;
    background-color: #fff;
    padding: 10px 8px;
    margin-top: 10px;
    border-radius: 6px;
    border: 1px solid #ddd;
  }

  .notice-item .item-content .item-title {
    line-height: 17px;
    font-size: 14px;
    color: #333;
    font-weight: bold;
  }

  .notice-item .item-content .item-txt {
    font-size: 12px;
    color: #666;
  }
</style>
